package com.scau.yangsuiyu.estore.dababases.entity;

import javax.persistence.*;
import java.util.Objects;

/**
 * @author suiyu_yang
 * @description
 * @date 2019-06-04 19:20
 * @email suiyu_yang@163.com
 */
@Entity
@IdClass(ReviewPK.class)
public class Review {
    private int id;
    private int goodsId;
    private Integer qualityScore;
    private Integer serviceScore;
    private Integer deliveryScore;
    private String profile;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Id
    @Column(name = "goods_id")
    public int getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(int goodsId) {
        this.goodsId = goodsId;
    }

    @Basic
    @Column(name = "quality_score")
    public Integer getQualityScore() {
        return qualityScore;
    }

    public void setQualityScore(Integer qualityScore) {
        this.qualityScore = qualityScore;
    }

    @Basic
    @Column(name = "service_score")
    public Integer getServiceScore() {
        return serviceScore;
    }

    public void setServiceScore(Integer serviceScore) {
        this.serviceScore = serviceScore;
    }

    @Basic
    @Column(name = "delivery_score")
    public Integer getDeliveryScore() {
        return deliveryScore;
    }

    public void setDeliveryScore(Integer deliveryScore) {
        this.deliveryScore = deliveryScore;
    }

    @Basic
    @Column(name = "profile")
    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Review review = (Review) o;
        return id == review.id &&
                goodsId == review.goodsId &&
                Objects.equals(qualityScore, review.qualityScore) &&
                Objects.equals(serviceScore, review.serviceScore) &&
                Objects.equals(deliveryScore, review.deliveryScore) &&
                Objects.equals(profile, review.profile);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, goodsId, qualityScore, serviceScore, deliveryScore, profile);
    }
}
